package com.bawei.module_my.nopay;

import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bawei.library_base.mvp.v.BaseActivity;
import com.bawei.library_base.room.paygood.PayGood;
import com.bawei.library_base.room.paygood.PayGoodDatabase;
import com.bawei.module_my.R;
import com.bawei.module_my.myorder.MyOrderAdapter;


import java.util.ArrayList;
import java.util.List;

public class NoPayActivity extends BaseActivity {


    private RecyclerView myNopayRv;

    @Override
    public int beanLayout() {
        return R.layout.activity_no_pay;
    }

    @Override
    public void initView() {

        myNopayRv = (RecyclerView) findViewById(R.id.my_nopay_rv);
        myNopayRv.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
    }

    @Override
    public void initData() {


        //适配
        adapter();
    }

    private void adapter() {
        List<PayGood> allGood = PayGoodDatabase.getInstance(getApplicationContext()).getPayGoodDao().getAllGood();


        ArrayList<PayGood> payGoods = new ArrayList<>();

        for (PayGood payGood : allGood) {
            if (!payGood.isPcheck()){
                payGoods.add(payGood);
            }
        }
        NoPayAdapter noPayAdapter = new NoPayAdapter(payGoods);
        myNopayRv.setAdapter(noPayAdapter);
    }
}